//
//  RLCalculationMethod.m
//  MacStockApp
//
//  Created by Andy MacPro on 12/8/8.
//
//

#import "RLCalculationMethod.h"

#import "GBCalculationMethod_commonIndicator.h"
#import "GBCalculationMethod_selfIndicator.h"
#import "GBall.h"
#import "DHxlsReaderIOS.h"
#import "File_Name_Path.h"

@implementation RLCalculationMethod


//建立計算方法參數表格屬性 字典
+(NSMutableDictionary *)calculate_method_property{
    
    //從excel取回 資料 還原字典
    NSMutableDictionary *retdic=[[[NSMutableDictionary alloc] init] autorelease];
    {
        
        //1.取得資料庫在資源裏面的路徑
        NSString *resourcePath;
        {
            resourcePath= [[NSBundle mainBundle] pathForResource:[File_Name_Path file_name_RLCalculationMethod] ofType:@"xls"];
           
            NSLog(@"存放資源檔的位置:%@" ,resourcePath);
        
        }
        
        //2.excel 讀檔
        DHxlsReader *reader = [DHxlsReader xlsReaderFromFile:resourcePath];
       
        
        //3.檔案基本資料
        {
            NSString *text = @"";
            
            text = [text stringByAppendingFormat:@"AppName: %@\n", reader.appName];
            text = [text stringByAppendingFormat:@"Author: %@\n", reader.author];
            text = [text stringByAppendingFormat:@"Category: %@\n", reader.category];
            text = [text stringByAppendingFormat:@"Comment: %@\n", reader.comment];
            text = [text stringByAppendingFormat:@"Company: %@\n", reader.company];
            text = [text stringByAppendingFormat:@"Keywords: %@\n", reader.keywords];
            text = [text stringByAppendingFormat:@"LastAuthor: %@\n", reader.lastAuthor];
            text = [text stringByAppendingFormat:@"Manager: %@\n", reader.manager];
            text = [text stringByAppendingFormat:@"Subject: %@\n", reader.subject];
            text = [text stringByAppendingFormat:@"Title: %@\n", reader.title];
            
            text = [text stringByAppendingFormat:@"\n\nNumber of Sheets: %ld\n", reader.numberOfSheets];
            
            NSLog(@"檔案基本資料：%@",text);
        }
        
        //4.sheets 資料
        {
             
            
            for (int i=0; i< reader.numberOfSheets ; i++) {
                
                NSString *sheetname=[reader sheetNameAtIndex:i] ;
                
                NSLog(@"sheet name=%@",sheetname);
                
            }
            
            
        }
        
        //5.取出第一個sheet 資料 並做成陣列資料
        int sheetIndex=0;
        {
            
            //取出dic_key excel 行標題
            NSMutableArray *dic_key_array=[[[NSMutableArray alloc] init] autorelease];
            {
                
                int row = 4; //開始的行位置
                 
                while(YES) {
                    
                    //中斷檢查用
                    DHcell *cell_check  = [reader cellInWorkSheetIndex:sheetIndex row:row col:1];
                    if(cell_check.type == cellBlank) break;
                    
                    //如果col:1有資料 就取出同一row資料
                    DHcell *cella  = [reader cellInWorkSheetIndex:0 row:row col:1];
                    
                    
                    [dic_key_array addObject:[cella str]];
                    
                    row++;
                    
                    
                }
                
                //NSLog(@"dic_key_array=%@",dic_key_array );
            }
           
            
            //取出dic_sub_key excel 列標題 與屬性
            NSMutableArray *dic_sub_key=[[[NSMutableArray alloc] init] autorelease];
            {
                int coll=2; //開始的列位置
                
                while(YES) {
                    
                    //中斷檢查用
                    DHcell *cell_check  = [reader cellInWorkSheetIndex:sheetIndex row:2 col:coll];
                    if(cell_check.type == cellBlank) break;
                    
                    //如果col:1有資料 就取出同一row資料
                    DHcell *cellrow1  = [reader cellInWorkSheetIndex:0 row:2 col:coll];
                    DHcell *cellrow2  = [reader cellInWorkSheetIndex:0 row:3 col:coll];
                    
                    NSMutableDictionary *dicp=[[NSMutableDictionary alloc] init] ;
                    [dicp setObject:[cellrow1 str] forKey:@"dic_sub_key"];
                    [dicp setObject:[cellrow2 str] forKey:@"dic_sub_pro"];
                    [dic_sub_key addObject:dicp];
                    [dicp release];
                    //  NSLog(@"%@/%@ ", [cellrow1 str],[cellrow2 str] );
                    
                    
                    
                    
                    
                    coll++;
                    
                    
                }
                
                //NSLog(@"dic_sub_key=%@",dic_sub_key );
            }
             
            
            // 進入excel資料內 建制複製還原             
            for (int row=0; row<[dic_key_array count]; row++) {
                
                NSString *key=[dic_key_array objectAtIndex:row];
                
                NSMutableDictionary *subdic=[[NSMutableDictionary alloc] init];
                {
                    for (int col=0; col<[dic_sub_key count]; col++) {
                        NSMutableDictionary *sss=[dic_sub_key objectAtIndex:col];
                        
                        NSString *subkey=[sss objectForKey:@"dic_sub_key"];
                        NSString *subpro=[sss objectForKey:@"dic_sub_pro"];
                        
                        //excel 資料
                        DHcell *cell_value  = [reader cellInWorkSheetIndex:sheetIndex row:row+4 col:col+2];
                        
                        if ([subpro isEqualToString:@"__NSCFNumber"]) {
                            float fvalue= [[cell_value str] floatValue];
                            
                            [subdic setObject:[NSNumber numberWithFloat:fvalue]  forKey:subkey];
                            
                        }
                        else if ([subpro isEqualToString:@"__NSCFBoolean"]) {
                            BOOL bvalue= [[cell_value str] boolValue];
                            
                            [subdic setObject:[NSNumber numberWithBool:bvalue]  forKey:subkey];
                            
                        }
                        else{
                            //存入資料
                            [subdic setObject:[cell_value str] forKey:subkey];
                            
                        }
                        
                        
                        
                        
                    }
                    
                    
                }
                
                
                [retdic setObject:subdic forKey:key];
                [subdic release];                 
            }
            //NSLog(@"retdic=%@",retdic);
            
            
        }
        
        
        
        
    }
    return retdic;
 
    //傳統模式
    /*
    //功能步驟：計算方法 功能步驟:1 建立計算方法參數表格屬性
    
    NSMutableDictionary *cmp=[[[NSMutableDictionary alloc] init] autorelease];
    
    //移動均線
    {
        NSMutableDictionary *cmp_sub=[[[NSMutableDictionary alloc] init] autorelease];
        [cmp setObject:cmp_sub  forKey:Defaults_Calculate_MA];
        
        //初始值
        [cmp_sub setObject:[NSNumber numberWithFloat:5] forKey:Para_Default_value_1];
        [cmp_sub setObject:[NSNumber numberWithFloat:20] forKey:Para_Default_value_2];
        [cmp_sub setObject:[NSNumber numberWithFloat:60] forKey:Para_Default_value_3];
        [cmp_sub setObject:[NSNumber numberWithFloat:120] forKey:Para_Default_value_4];
        [cmp_sub setObject:[NSNumber numberWithFloat:240] forKey:Para_Default_value_5];
        
        //是否隱藏參數欄位
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_1];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_2];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_3];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_4];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_5];
                
        //顯示參數欄位
        [cmp_sub setObject:@"para_title_ma_1" forKey:Para_title_1];
        [cmp_sub setObject:@"para_title_ma_2" forKey:Para_title_2];
        [cmp_sub setObject:@"para_title_ma_3" forKey:Para_title_3];
        [cmp_sub setObject:@"para_title_ma_4" forKey:Para_title_4];
        [cmp_sub setObject:@"para_title_ma_5" forKey:Para_title_5];
        
        //停損機制
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_Optimize_isUse_Stop];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.15] forKey:Para_Optimize_Stop_ratio];
        
        //交易成本
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_long_cost];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_short_cost];
        
        
    }
    
    //KD
    {
        NSMutableDictionary *cmp_sub=[[[NSMutableDictionary alloc] init] autorelease];
        [cmp setObject:cmp_sub  forKey:Defaults_Calculate_KD];
        
        //初始值
        [cmp_sub setObject:[NSNumber numberWithFloat:9] forKey:Para_Default_value_1];
        [cmp_sub setObject:[NSNumber numberWithFloat:3] forKey:Para_Default_value_2];
        [cmp_sub setObject:[NSNumber numberWithFloat:3] forKey:Para_Default_value_3];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_4];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_5];
        
        //是否隱藏參數欄位
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_1];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_2];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_3];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_4];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_5];
        
        //顯示參數欄位
        [cmp_sub setObject:@"para_title_kd_1" forKey:Para_title_1];
        [cmp_sub setObject:@"para_title_kd_2" forKey:Para_title_2];
        [cmp_sub setObject:@"para_title_kd_3" forKey:Para_title_3];
        [cmp_sub setObject:@"para_title_kd_4" forKey:Para_title_4];
        [cmp_sub setObject:@"para_title_kd_5" forKey:Para_title_5];
        
        //停損機制
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_Optimize_isUse_Stop];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.15] forKey:Para_Optimize_Stop_ratio];
        
        //交易成本
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_long_cost];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_short_cost];
    }
    
    //MACD
    {
        NSMutableDictionary *cmp_sub=[[[NSMutableDictionary alloc] init] autorelease];
        [cmp setObject:cmp_sub  forKey:Defaults_Calculate_MACD];
        
        //初始值
        [cmp_sub setObject:[NSNumber numberWithFloat:9] forKey:Para_Default_value_1];
        [cmp_sub setObject:[NSNumber numberWithFloat:12] forKey:Para_Default_value_2];
        [cmp_sub setObject:[NSNumber numberWithFloat:26] forKey:Para_Default_value_3];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_4];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_5];
        
        //是否隱藏參數欄位
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_1];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_2];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_3];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_4];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_5];
        
        //顯示參數欄位
        [cmp_sub setObject:@"para_title_MACD_1" forKey:Para_title_1];
        [cmp_sub setObject:@"para_title_MACD_2" forKey:Para_title_2];
        [cmp_sub setObject:@"para_title_MACD_3" forKey:Para_title_3];
        [cmp_sub setObject:@"para_title_MACD_4" forKey:Para_title_4];
        [cmp_sub setObject:@"para_title_MACD_5" forKey:Para_title_5];
        
        //停損機制
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_Optimize_isUse_Stop];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.15] forKey:Para_Optimize_Stop_ratio];
        
        //交易成本
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_long_cost];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_short_cost];
    }
    
    //MESA1
    {
        NSMutableDictionary *cmp_sub=[[[NSMutableDictionary alloc] init] autorelease];
        [cmp setObject:cmp_sub  forKey:Defaults_Calculate_MESA1];
        
        //初始值
        [cmp_sub setObject:[NSNumber numberWithFloat:0.3] forKey:Para_Default_value_1];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.03] forKey:Para_Default_value_2];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_3];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_4];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_5];
        
        //是否隱藏參數欄位
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_1];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_2];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_3];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_4];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_5];
        
        //顯示參數欄位
        [cmp_sub setObject:@"para_title_MESA1_1" forKey:Para_title_1];
        [cmp_sub setObject:@"para_title_MESA1_2" forKey:Para_title_2];
        [cmp_sub setObject:@"para_title_MESA1_3" forKey:Para_title_3];
        [cmp_sub setObject:@"para_title_MESA1_4" forKey:Para_title_4];
        [cmp_sub setObject:@"para_title_MESA1_5" forKey:Para_title_5];
        
        //停損機制
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_Optimize_isUse_Stop];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.15] forKey:Para_Optimize_Stop_ratio];
        
        //交易成本
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_long_cost];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_short_cost];
        
    }
    
    //MESA2
    {
        NSMutableDictionary *cmp_sub=[[[NSMutableDictionary alloc] init] autorelease];
        [cmp setObject:cmp_sub  forKey:Defaults_Calculate_MESA2];
        
        //初始值
        [cmp_sub setObject:[NSNumber numberWithFloat:0.4] forKey:Para_Default_value_1];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.04] forKey:Para_Default_value_2];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_3];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_4];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_5];
        
        //是否隱藏參數欄位
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_1];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_2];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_3];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_4];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_5];
        
        //顯示參數欄位
        [cmp_sub setObject:@"para_title_MESA2_1" forKey:Para_title_1];
        [cmp_sub setObject:@"para_title_MESA2_2" forKey:Para_title_2];
        [cmp_sub setObject:@"para_title_MESA2_3" forKey:Para_title_3];
        [cmp_sub setObject:@"para_title_MESA2_4" forKey:Para_title_4];
        [cmp_sub setObject:@"para_title_MESA2_5" forKey:Para_title_5];
        
        //停損機制
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_Optimize_isUse_Stop];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.15] forKey:Para_Optimize_Stop_ratio];
        
        //交易成本
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_long_cost];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_short_cost];
    }
    
    //MESA3
    {
        NSMutableDictionary *cmp_sub=[[[NSMutableDictionary alloc] init] autorelease];
        [cmp setObject:cmp_sub  forKey:Defaults_Calculate_MESA3];
        
        //初始值
        [cmp_sub setObject:[NSNumber numberWithFloat:0.5] forKey:Para_Default_value_1];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.05] forKey:Para_Default_value_2];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_3];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_4];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_5];
        
        //是否隱藏參數欄位
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_1];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_2];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_3];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_4];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_5];
        
        //顯示參數欄位
        [cmp_sub setObject:@"para_title_MESA3_1" forKey:Para_title_1];
        [cmp_sub setObject:@"para_title_MESA3_2" forKey:Para_title_2];
        [cmp_sub setObject:@"para_title_MESA3_3" forKey:Para_title_3];
        [cmp_sub setObject:@"para_title_MESA3_4" forKey:Para_title_4];
        [cmp_sub setObject:@"para_title_MESA3_5" forKey:Para_title_5];
        
        //停損機制
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_Optimize_isUse_Stop];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.15] forKey:Para_Optimize_Stop_ratio];
        
        //交易成本
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_long_cost];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_short_cost];
    }
    
    //LF1
    {
        NSMutableDictionary *cmp_sub=[[[NSMutableDictionary alloc] init] autorelease];
        [cmp setObject:cmp_sub  forKey:Defaults_Calculate_LF1];
        
        //初始值
        [cmp_sub setObject:[NSNumber numberWithFloat:0.2] forKey:Para_Default_value_1];
        [cmp_sub setObject:[NSNumber numberWithFloat:20] forKey:Para_Default_value_2];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.3] forKey:Para_Default_value_3];
        [cmp_sub setObject:[NSNumber numberWithFloat:30] forKey:Para_Default_value_4];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_5];
        
        //是否隱藏參數欄位
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_1];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_2];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_3];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_4];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_5];
        
        //顯示參數欄位
        [cmp_sub setObject:@"para_title_LF1_1" forKey:Para_title_1];
        [cmp_sub setObject:@"para_title_LF1_2" forKey:Para_title_2];
        [cmp_sub setObject:@"para_title_LF1_3" forKey:Para_title_3];
        [cmp_sub setObject:@"para_title_LF1_4" forKey:Para_title_4];
        [cmp_sub setObject:@"para_title_LF1_5" forKey:Para_title_5];
        
        //停損機制
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_Optimize_isUse_Stop];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.15] forKey:Para_Optimize_Stop_ratio];
        
        //交易成本
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_long_cost];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_short_cost];
        
    }
    
    //LF2
    {
        NSMutableDictionary *cmp_sub=[[[NSMutableDictionary alloc] init] autorelease];
        [cmp setObject:cmp_sub  forKey:Defaults_Calculate_LF2];
        
        //初始值
        [cmp_sub setObject:[NSNumber numberWithFloat:0.22] forKey:Para_Default_value_1];
        [cmp_sub setObject:[NSNumber numberWithFloat:22] forKey:Para_Default_value_2];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.32] forKey:Para_Default_value_3];
        [cmp_sub setObject:[NSNumber numberWithFloat:32] forKey:Para_Default_value_4];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_5];
        
        //是否隱藏參數欄位
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_1];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_2];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_3];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_4];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_5];
        
        //顯示參數欄位
        [cmp_sub setObject:@"para_title_LF2_1" forKey:Para_title_1];
        [cmp_sub setObject:@"para_title_LF2_2" forKey:Para_title_2];
        [cmp_sub setObject:@"para_title_LF2_3" forKey:Para_title_3];
        [cmp_sub setObject:@"para_title_LF2_4" forKey:Para_title_4];
        [cmp_sub setObject:@"para_title_LF2_5" forKey:Para_title_5];
        
        //停損機制
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_Optimize_isUse_Stop];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.15] forKey:Para_Optimize_Stop_ratio];
        
        //交易成本
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_long_cost];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_short_cost];
        
    }
   
    //LF3
    {
        NSMutableDictionary *cmp_sub=[[[NSMutableDictionary alloc] init] autorelease];
        [cmp setObject:cmp_sub  forKey:Defaults_Calculate_LF3];
        
        //初始值
        [cmp_sub setObject:[NSNumber numberWithFloat:0.23] forKey:Para_Default_value_1];
        [cmp_sub setObject:[NSNumber numberWithFloat:23] forKey:Para_Default_value_2];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.33] forKey:Para_Default_value_3];
        [cmp_sub setObject:[NSNumber numberWithFloat:33] forKey:Para_Default_value_4];
        [cmp_sub setObject:[NSNumber numberWithFloat:0] forKey:Para_Default_value_5];
        
        //是否隱藏參數欄位
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_1];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_2];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_3];
        [cmp_sub setObject:[NSNumber numberWithBool:NO] forKey:Para_title_isHidden_4];
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_title_isHidden_5];
        
        //顯示參數欄位
        [cmp_sub setObject:@"para_title_LF3_1" forKey:Para_title_1];
        [cmp_sub setObject:@"para_title_LF3_2" forKey:Para_title_2];
        [cmp_sub setObject:@"para_title_LF3_3" forKey:Para_title_3];
        [cmp_sub setObject:@"para_title_LF3_4" forKey:Para_title_4];
        [cmp_sub setObject:@"para_title_LF3_5" forKey:Para_title_5];
        
        //停損機制
        [cmp_sub setObject:[NSNumber numberWithBool:YES] forKey:Para_Optimize_isUse_Stop];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.15] forKey:Para_Optimize_Stop_ratio];
        
        //交易成本
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_long_cost];
        [cmp_sub setObject:[NSNumber numberWithFloat:0.0015] forKey:Para_Optimize_short_cost];
        
    }
     return  cmp;     
   */
    
    
           

}

@end
